package com.example.librarysysee.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;


@Aspect
@Slf4j
@Component
public class TimRecordAspect {
    @Around("execution(* com.example.librarysysee.controller.*.*(..))")
    public Object record(ProceedingJoinPoint pj) throws Throwable {
        long st = System.currentTimeMillis();
        Object result = pj.proceed();
        log.info(pj.getSignature()+"cost_time:"+(System.currentTimeMillis()-st)+"ms");
        return result;
    }
}
